home *** CD-ROM | disk | FTP | other *** search
/ BCI NET 2 / BCI NET 2.iso / archives / applications / wp / macro28.lha / Macro / FinsGold / TeX / LaTeXRef.ged < prev    next >
Encoding:
Text File  |  1994-06-09  |  4.4 KB  |  151 lines

  1. /** $VER: LaTeXRef.ged 0.5 (8. Jun. '94)
  2.  **
  3.  ** Dieses Skript für den Editor GoldED (von Dietmar Eilert) er-
  4.  ** mittelt das Wort unter dem Cursor und versucht daraufhin
  5.  ** die entsprechende Seite aus der Hypertext-Datei "LaTeX.guide"
  6.  ** von ?? anzuzeigen.
  7.  ** Für einige wenige Wörter wurde ein "Ausnahmelexikon" erstellt.
  8.  ** Die notwendige Cross-Referenz-Datei "latex.xref" wurde mit SORT
  9.  ** und SEARCH per Hand erstellt.
  10.  ** Das Skript ist noch nicht ganz ausgereift, sollte aber in den
  11.  ** meisten Fällen das gewünschte Ergebnis liefern.
  12.  **
  13.  ** My address:
  14.  **
  15.  **   Fin Schuppenhauer
  16.  **   Brausspark 10
  17.  **   D-20537 Hamburg
  18.  **   (Germany)
  19.  **
  20.  ** E-Mail: 1schuppe@rzdspc2.informatik.uni-hamburg.de
  21.  **
  22.  ** This script is FREEWARE.
  23.  **
  24.  ** Thanks to:
  25.  **   Dietmar Eilert for his GoldED
  26.  **   David N. Junod
  27.  **/
  28.  
  29. OPTIONS RESULTS                             /* enable return codes     */
  30.  
  31. if (LEFT(ADDRESS(), 6) ~= "GOLDED") then    /* not started by GoldEd ? */
  32.     address 'GOLDED.1'
  33.  
  34. 'LOCK CURRENT'                              /* lock GUI, gain access   */
  35. OPTIONS FAILAT 6                            /* ignore warnings         */
  36. SIGNAL ON SYNTAX                            /* ensure clean exit       */
  37.  
  38.  
  39. /* ------------------------ INSERT YOUR CODE HERE: ------------------- */
  40.  
  41.  
  42. 'QUERY CAT'
  43. isGerman = (result = "deutsch")
  44.  
  45. /* amigaguide.library öffnen (falls dies noch nicht geschehen ist): */
  46. if ~show('L','amigaguide.library') then
  47.    if ~addlib('amigaguide.library',0,-30) then do
  48.       if isGerman then
  49.          'REQUEST BODY="Keine amigaguide.library vorhanden!" BUTTON=Abbrechen'
  50.       else
  51.          'REQUEST BODY="amigaguide.library not available!" BUTTON=Cancel'
  52.       'UNLOCK'
  53.       EXIT
  54.    end
  55.  
  56. /* call ExpungeXRef */
  57.  
  58. /* Wort unter dem Cursor ermitteln: */
  59. 'QUERY WORD VAR WORT'
  60. wort = strip(wort,'B','"')       /* document _ ^ */
  61.  
  62. /* Ausnahme-Knoten: */
  63. select
  64.    when UPPER(wort)="REFERENCES" then wort="Cross References"
  65.    when UPPER(wort)="DOCUMENT"   then wort="Document Styles"
  66.    when UPPER(wort)="MATH"       then wort="Math Formulae"
  67.    when UPPER(wort)="FORMULAE"   then wort="Math Formulae"
  68.    when UPPER(wort)="PAGE"       then wort="Page Styles"
  69.    when UPPER(wort)="BOX"        then wort="Spaces & Boxes"
  70.    when UPPER(wort)="SPACE"      then wort="Spaces & Boxes"
  71.    when wort="\tableofcontents"  then wort="Table of Contents"
  72.    when wort="\-"                then wort="\- (tabbing)"
  73.    when wort="\Huge"             then wort="\Huge (capitel `h`)"
  74.    when wort="\Large"            then wort="\Large (capitel `l`)"
  75.    when wort="\LARGE"            then wort="\LARGE (all caps)"
  76.    when wort="^"                 then wort="^{exp} (superscript)"
  77.    when wort="_"                 then wort="_{exp} (subscript)"
  78.    otherwise
  79. end
  80.  
  81. if isGerman then
  82.    'REQUEST BODY="Informationen laden für:" OLD="'wort'" STRING VAR=WORT'
  83. else
  84.    'REQUEST BODY="Loading information for:" OLD="'wort'" STRING VAR=WORT'
  85. if rc ~= 0 then do
  86.    'UNLOCK'
  87.    EXIT
  88. end
  89.  
  90. /* LaTeX cross-reference table laden, wenn noch nicht vorhanden: */
  91. line = GetXRef("\include")
  92. if line = 10 then do
  93.    if isGerman then
  94.       'REQUEST STATUS="Lade Cross-Reference Datei ..."'
  95.    else
  96.       'REQUEST STATUS="Loading cross-reference file ..."'
  97.    call LoadXRef(latex.xref)
  98. end
  99.  
  100. /* Gibt es das Wort in der cross-reference-table? */
  101. line = GetXRef(wort)
  102.  
  103. if line = 10 then do
  104.    /* Das gesuchte Wort ist nicht in der Database LaTeX.guide vorhanden. */
  105.    if isGerman then
  106.       'REQUEST BODY="'wort': Unbekanntes Schlüsselwort"'
  107.    else
  108.       'REQUEST BODY="'wort': Unknown keyword"'
  109.    'UNLOCK'
  110.    EXIT
  111. end
  112. if isGerman then
  113.    'REQUEST STATUS="Lade ' || wort || ' ..."'
  114. else
  115.    'REQUEST STATUS="Loading '|| wort ||' ..."'
  116.  
  117. /* Haben wir schon ein Autodoc-Fenster geöffnet? */
  118. if ~show('P','LATEXDOCS') then do
  119.    cmd = 'run >NIL: AmigaGuide document "' || wort || '" portname LATEXDOCS pubscreen GOLDED.1'
  120.    ADDRESS COMMAND cmd
  121. end
  122. else do
  123.    link = "Link"
  124.  
  125.    cmd = link || ' "' || wort || '"'
  126.  
  127.    OPTIONS FAILAT 21
  128.    ADDRESS LATEXDOCS cmd
  129.    if rc = 20 then
  130.       if isGerman then
  131.          'REQUEST BODY="Keine Information für|'''wort''' vorhanden." BUTTON=Ok'
  132.       else
  133.          'REQUEST BODY="No information for|'''wort''' available." BUTTON=Ok'
  134.    else
  135.       ADDRESS LATEXDOCS "windowtofront"
  136. end
  137.  
  138.  
  139. /* ---------------------------- END OF YOUR CODE --------------------- */
  140.  
  141. 'UNLOCK' /* VERY important: unlock GUI */
  142. EXIT
  143.  
  144. SYNTAX:
  145.  
  146. SAY "Sorry, error line" SIGL ":" ERRORTEXT(RC) ":-("
  147. 'UNLOCK'
  148. EXIT
  149.  
  150.  
  151.